<template>
  <el-row>
    <el-col :span="6"><div class="grid-content bg-purple">
      e
    </div></el-col>
    <el-col :span="12">
      <div class="grid-content bg-purple-light">
        <el-descriptions title="实验结束">
          <el-descriptions-item label="姓名">{{$store.state.currentStudent.name}}</el-descriptions-item>
          <el-descriptions-item label="学号">{{$store.state.currentStudent.studentId}}</el-descriptions-item>
          <el-descriptions-item label="实验总分">{{ttl}}</el-descriptions-item>
          <el-descriptions-item label="问诊、检查单项得分">
            <div v-for="(score,index) in dialogueScore">
            第{{index+1}}幕得分：{{score}}
            </div>
          </el-descriptions-item>
          <el-descriptions-item label="治疗单项得分">
            <div v-for="(score,index) in therapyScore">
              第{{index+1}}幕得分：{{score}}
            </div>
          </el-descriptions-item>
          <el-descriptions-item label="诊断得分">
            {{diagnosisScore}}
          </el-descriptions-item>
        </el-descriptions>
        <div>
          <h3>本次实验，您的综合评价是</h3>
          <h1 v-if="ttl > 50">S</h1>
          <h1 v-if="ttl > 40&&ttl<=50">A</h1>
          <h1 v-if="ttl > 30&&ttl<=40">B</h1>
          <h1 v-if="ttl > 20&&ttl<=30">C</h1>
          <h1 v-if="ttl > 10&&ttl<=20">D</h1>
          <h1 v-if="ttl<=10">F</h1>
        </div>
        <div>
          请对我们的系统作出评价：<el-rate v-model="value1"></el-rate>
          <el-button type="danger" @click="exit">退出实验</el-button>
        </div>
      </div>
    </el-col>
    <el-col :span="6"><div class="grid-content bg-purple">

    </div></el-col>
  </el-row>


</template>

<script>
export default {
  name: "FinishPage",
  data() {
    return{
      dialogueScore:[0.0,0.0,0.0],
      therapyScore:[0.0,0.0,0.0],
      diagnosisScore:0,
      value1:3
    }
  },
  computed:{
    ttl(){
      let dialog =this.dialogueScore[0]+this.dialogueScore[1]+this.dialogueScore[2]
      let therapy =this.therapyScore[0]+this.therapyScore[1]+this.therapyScore[2]
      return dialog+therapy+this.diagnosisScore
    }
  },
  beforeMount() {
    //获取问诊检查得分
    for(let index in this.$store.state.dialogues){
      for(let indexx in this.$store.state.dialogues[index]){
        this.dialogueScore[index] += this.$store.state.dialogues[index][indexx].pts
      }
    }
    //获取治疗得分
    for(let index in this.$store.state.therapies){
      for(let indexx in this.$store.state.therapies[index]){
        this.therapyScore[index] += this.$store.state.therapies[index][indexx].pts
      }
    }
    //获取诊断得分
    this.diagnosisScore = this.$store.state.diagnosis["basic"].length + this.$store.state.diagnosis["checked"].length
  },
  methods:{
    exit(){
      this.$notify.info({
        title: '消息',
        message: '您已结束实验'
      });
      sessionStorage.removeItem('token')
      this.$router.push('/login')
    }
  }
}
</script>

<style scoped>

</style>
